#ifndef STORAGE_CONNECTION_CONFIG_HPP
#define STORAGE_CONNECTION_CONFIG_HPP

#include "Storage/StorageConfig.hpp"
#include <iosfwd>
#include <string>
#include <map>

namespace Storage
{

class StorageFactory;

/// @ingroup Storage
/// @brief It holds the information regarding a connection configuration.
class STORAGE_API ConnectionConfig
{
public:
	/// @brief It initializes the name of the connection.
	ConnectionConfig( const std::string& typeName, const std::string& name);
	
	/// @brief Dummy destructor
	virtual ~ConnectionConfig();

	/// @brief It gets the name of the configuration.
	const std::string& name() const { return name_; }

	/// @brief It sets the name of the configuration.
	void setName( const std::string& newName) { name_ = newName; }

	/// @brief It gets the name of the connection type.
	const std::string& typeName() const { return typeName_; }

	/// @brief It stores the configuration data to the specified stream.
	virtual void store( std::ostream& os);

	/// @brief It loads the configuration data from the specified stream. It should assume that the name of the 
	///		configuration is already loaded and only the rest of the attributes need to be loaded.
	virtual void load( std::istream& is);

	/// @brief It creates the storage factory that provides access to specialized storages for each case entity.
	virtual StorageFactory* createStorageFactory() const = 0;

private:
	std::string name_;
	std::string typeName_;

protected:
	typedef std::map< std::string, std::string> AttributeCollection;
	AttributeCollection attributes_;
};

} // namespace Storage

#endif // STORAGE_CONNECTION_CONFIG_HPP
